package com.acdc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.acdc.domain.Dlt698Log;
import com.acdc.service.IDlt698LogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * DLT698指令日志Controller
 * 
 * @author acdc
 * @date 2025-08-13
 */
@RestController
@RequestMapping("/iot/log")
public class Dlt698LogController extends BaseController
{
    @Autowired
    private IDlt698LogService dlt698LogService;

    /**
     * 查询DLT698指令日志列表
     */
    @PreAuthorize("@ss.hasPermi('iot:log:list')")
    @GetMapping("/list")
    public TableDataInfo list(Dlt698Log dlt698Log)
    {
        startPage();
        List<Dlt698Log> list = dlt698LogService.selectDlt698LogList(dlt698Log);
        return getDataTable(list);
    }

    /**
     * 导出DLT698指令日志列表
     */
    @PreAuthorize("@ss.hasPermi('iot:log:export')")
    @Log(title = "DLT698指令日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Dlt698Log dlt698Log)
    {
        List<Dlt698Log> list = dlt698LogService.selectDlt698LogList(dlt698Log);
        ExcelUtil<Dlt698Log> util = new ExcelUtil<Dlt698Log>(Dlt698Log.class);
        util.exportExcel(response, list, "DLT698指令日志数据");
    }

    /**
     * 获取DLT698指令日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('iot:log:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(dlt698LogService.selectDlt698LogById(id));
    }

    /**
     * 新增DLT698指令日志
     */
    @PreAuthorize("@ss.hasPermi('iot:log:add')")
    @Log(title = "DLT698指令日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Dlt698Log dlt698Log)
    {
        return toAjax(dlt698LogService.insertDlt698Log(dlt698Log));
    }

    /**
     * 修改DLT698指令日志
     */
    @PreAuthorize("@ss.hasPermi('iot:log:edit')")
    @Log(title = "DLT698指令日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Dlt698Log dlt698Log)
    {
        return toAjax(dlt698LogService.updateDlt698Log(dlt698Log));
    }

    /**
     * 删除DLT698指令日志
     */
    @PreAuthorize("@ss.hasPermi('iot:log:remove')")
    @Log(title = "DLT698指令日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dlt698LogService.deleteDlt698LogByIds(ids));
    }
}
